import json


def getPoint(score):
    point = score // 10 - 5
    if point < 0:
        point = 0
    return point


class StudentCurrm:
    def __init__(self, currmId, currmName, teacherName, score, point):
        self.currmId = currmId
        self.currmName = currmName
        self.teacherName = teacherName
        self.point = point
        self.score = score

    @staticmethod
    def result_to_json(result):
        entity = StudentCurrm(result[3], result[0], result[1], result[2], getPoint(result[2]))
        return json.dumps(entity.__dict__)

    @staticmethod
    def result_to_entity(result):
        entity = StudentCurrm(result[3],result[0], result[1], result[2], getPoint(result[2]))
        return entity

    @staticmethod
    def result_to_entity_dict(result):
        entity = StudentCurrm(result[3], result[0], result[1], result[2], getPoint(result[2]))
        return entity.__dict__
